package com.webproject.core.utils;

import cn.hutool.jwt.JWTUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * token工具类 用于生成token
 * @Date: 2023/1/6
 */

public class TokenUtils {

    public static String createJwtToken(String userId, String username, String jwtKey){
        Map<String, Object> jwtMap = new HashMap<String,Object>(){{
            put("userId",userId);
            put("username",username);
        }};
        return JWTUtil.createToken(jwtMap, jwtKey.getBytes());
    }
}
